package com.xls.box2023.jinbi.tixian;


import android.app.Activity;
import android.content.Intent;
import android.text.InputType;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.lzz.bottomencapsulation.utils.TUtils;
import com.xls.box2023.Consts.IntentConsts;
import com.xls.box2023.R;
import com.xls.box2023.mvp.MVPBaseActivity;


/**
 * MVPPlugin
 */

public class TiXianActivity extends MVPBaseActivity<TiXianContract.View, TiXianPresenter> implements TiXianContract.View, View.OnClickListener {

    private TextView title_text;
    private TextView title_back;
    private RelativeLayout title_rl_content;
    private TextView tixian_jine;
    private EditText tixian_num;
    private TextView tixian_unit;
    private TextView tixian_guxianguize_title;
    private TextView tixian_guxianguize_hint;
    private TextView tixian_btn;

    public static void startActivity(Activity activity,String maxnum) {
        Intent intent=new Intent(activity, TiXianActivity.class);
        intent.putExtra(IntentConsts.data,maxnum);
        activity.startActivity(intent);
    }

    @Override
    public int getView() {
        return R.layout.activity_tixian;
    }

    @Override
    public void initView() {

        title_text = findViewById(R.id.title_text);
        title_back = findViewById(R.id.title_back);
        title_rl_content = findViewById(R.id.title_rl_content);
        tixian_jine = findViewById(R.id.tixian_jine);
        tixian_num = findViewById(R.id.tixian_num);
        tixian_unit = findViewById(R.id.tixian_unit);
        tixian_guxianguize_title = findViewById(R.id.tixian_guxianguize_title);
        tixian_guxianguize_hint = findViewById(R.id.tixian_guxianguize_hint);
        tixian_btn = findViewById(R.id.tixian_btn);
        tixian_btn.setOnClickListener(this);
        title_back.setOnClickListener(this);
        title_text.setText("金币提现");
        tixian_num.requestFocus();

    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.tixian_btn) {
            Double text=Double.parseDouble(tixian_num.getText().toString().trim());
            if (!TextUtils.isEmpty(tixian_num.getText().toString().trim())&&text>0&&text<=500){
                mPresenter.getPermissions(tixian_num.getText().toString().trim());
            }else {
                TUtils.showShort(this,"输入金额不合规，请重新输入");
            }
        }else if (view.getId()==R.id.title_back){
            finish();
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        tixian_num.setInputType(InputType.TYPE_NULL); // 关闭软键盘
    }
}
